<?php
header("Content-Type: text/html; charset=utf-8");
require_once '../setting/setting.php';
require_once '../smarty/Smarty.class.php';
require_once '../lib/query_railway.php';
require_once '../lib/base.php';
$user=$_SESSION["RU"];
//var_dump($user);
if(!$user)header("Location:../user/login.php");
if($user["nick"]!="admin")exit;
if($_POST["act"]=="modify") {
	$i=urldecode($_POST["i"]);
	$type=urldecode($_POST["type"]);
	$valid=urldecode($_POST["valid"]);
	$status=urldecode($_POST["s"]);	
	$add20gp=urldecode($_POST["add20gp"]);
	$add40gp=urldecode($_POST["add40gp"]);
	$add40hc=urldecode($_POST["add40hc"]);
	$aremark=urldecode($_POST["aremark"]);
	$error=urldecode($_POST["error"]);
	$check_user=QR::check_exist($tb_user,"id=".$i);
	if(!$check_user){echo "非法错误！";exit;}
	if($i){
		$_set="set type='".$type."',valid='".$valid."',status='".$status."',add20gp=$add20gp,add40gp=$add40gp,add40hc=$add40hc,aremark='".$aremark."',error='".$error."' where id=".$i;
		$op=QR::update_data($tb_user,$_set);
		if($op>0)echo "100" ;else echo "数据未更新，请检查输入的正确性！";
	}else{
		echo "未知错误，请尝试重新登录！";
	}
		exit;
}

$rid=$_GET["i"];
if($rid){
	$str=" id='".$rid."'";
	$data=QR::get_data($tb_user, "*",$str,0,1);
	//var_dump($data);
	$smarty = new Smarty;
	$smarty->assign("udata",$data[0]);
	$smarty->assign("rid",$rid);
	$smarty->assign("user",$user);
	$smarty->display('user_verify.tpl');
}
?>